public class Leetcode461 {
    public static void main(String[] args) {
        System.out.println(hammingDistance(4, 1));
    }

    public static int hammingDistance(int x, int y) {
        int i = x ^ y;
        i = i - ((i >> 1) & 0x55555555);
        i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
        return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
    }
}
